package com.mallcai.bigdata.ladon.vo;

import com.mallcai.bigdata.ladon.dpl.entity.report.SqlRunLog;
import lombok.Data;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by oneape<oneape15@163.com>
 * Created 2019-06-04 10:45.
 * Modify:
 */
@Data
public class QueryParam implements Serializable {

    private String               rawSql; // 预处理后的sql, 如: SELECT * FROM table WHERE id = ?
    private Map<Integer, Object> params; // 查询参数
    private Integer              limitSize; // 限制返回条数
    private boolean              needLimit; // 是否需要限制条数
    private Map<String, String>  dataTypes; // 字段名称和显示类型的映射
    private SqlRunLog  sqlRunLog; // Sql运行日志对象

    private Integer timeout;

    /**
     * 放置参数
     * @param key
     * @param value
     */
    public void putParam(Integer key, Object value){
        if (this.params == null){
            this.params = new HashMap<>();
        }
        this.params.put(key, value);
    }

}
